package com.huahua.api.controller;

import com.huahua.api.base.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * @author LoveHuahua
 * @date 2022年01月09日 11:12
 * @description believe in yourself
 */
@RestController
public class TestController {


    @PostMapping("/test")
    public Object test(@RequestParam("file") MultipartFile multipartFile) throws IOException {
        File dest = new File("/" + multipartFile.getName());
        multipartFile.transferTo(dest);
        return R.success(dest.getAbsolutePath());
    }

}
